package na.learn.java.serialization;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class SimpleObject implements Externalizable {

	private int num;

	private String str;

	public void writeExternal(ObjectOutput output) throws IOException {
		output.writeInt(num);
		output.writeUTF(str);
	}

	public void readExternal(ObjectInput input) throws IOException,
			ClassNotFoundException {
		num = input.readInt();
		str = (String) input.readUTF();		
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public String getStr() {
		return str;
	}

	public void setStr(String str) {
		this.str = str;
	}
	
	public String toString(){
		return "num: " + getNum() + ", String: " + getStr();
		
	}

}
